package com.qj.daibei.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qj.daibei.mapper.ShouldPayBackMapper;
import com.qj.daibei.pojo.ShouldPayBack;
import com.qj.daibei.pojo.ShouldPayBackCustom;
import com.qj.daibei.service.ShouldPayBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author wml
 * Created on 2021/10/22 20:22
 */
@Service
public class ShouldPayBackServiceImpl implements ShouldPayBackService {

    @Autowired
    private ShouldPayBackMapper shouldPayBackMapper;

    @Override
    public int insertShouldPayBackByBatch(List<ShouldPayBack> list) {
        return this.shouldPayBackMapper.insertShouldPayBackByBatch(list);
    }

    @Override
    public List<ShouldPayBackCustom> findShouldPayBackCustomByLoanId(List loanIdList) {
        this.shouldPayBackMapper.findShouldPayBackCustomByLoanId(loanIdList);
        return null;
    }

    @Override
    public PageInfo<ShouldPayBackCustom> findShouldPayBackCustomByLoanIdByPage(List loanIdList, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ShouldPayBackCustom> shouldPayBackCustomList = this.shouldPayBackMapper.findShouldPayBackCustomByLoanId(loanIdList);
        PageInfo<ShouldPayBackCustom> pageInfo = new PageInfo<>(shouldPayBackCustomList, 5);
        return pageInfo;
    }

    @Override
    public int updateShouldPayBackById(ShouldPayBack shouldPayBack) {
        return this.shouldPayBackMapper.updateShouldPayBackById(shouldPayBack);
    }

    @Override
    public List<ShouldPayBackCustom> findShouldPayBackCustomByLoanIdAndOverdue(List loanIdList) {
        return this.shouldPayBackMapper.findShouldPayBackCustomByLoanIdAndOverdue(loanIdList);
    }
}
